import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 套餐维度配置 */
export interface PackageSetting {
  id: number // 模版编号
  package_id?: number // 套餐编号
  category_name?: number // 维度名称
  ids?: number[] // 配置
  creator?: string // 创建者
  create_time?: Date // 创建时间
  updater?: string // 更新者
  update_time?: Date // 更新时间
  deleted?: number // 是否删除
}

// 套餐维度配置 API
export const PackageSettingApi = {
  getPackageSettingList: async (params: any) => {
    return await request.get({ url: `/system/package-setting/simple-list`, params })
  },
  // 查询套餐维度配置文件分页
  getPackageSettingPage: async (params: any) => {
    return await request.get({ url: `/system/package-setting/page`, params })
  },

  // 查询套餐维度配置文件详情
  getPackageSetting: async (id: number) => {
    return await request.get({ url: `/system/package-setting/get?id=` + id })
  },

  // 新增套餐维度配置文件
  createPackageSetting: async (data: PackageSetting) => {
    return await request.post({ url: `/system/package-setting/create`, data })
  },

  // 修改套餐维度配置文件
  updatePackageSetting: async (data: PackageSetting) => {
    return await request.put({ url: `/system/package-setting/update`, data })
  },

  // 删除套餐维度配置文件
  deletePackageSetting: async (id: number) => {
    return await request.delete({ url: `/system/package-setting/delete?id=` + id })
  },

  /** 批量删除套餐维度配置文件 */
  deletePackageSettingList: async (ids: number[]) => {
    return await request.delete({ url: `/system/package-setting/delete-list?ids=${ids.join(',')}` })
  },

  // 导出套餐维度配置文件 Excel
  exportPackageSetting: async (params) => {
    return await request.download({ url: `/system/package-setting/export-excel`, params })
  }
}
